public class Test {
    public boolean chkPalindrome(ListNode A) {
        //空链表
        if(A == null){
            return false;
        }
        //只有一个
        if(A.next == null){
            return true;
        }
        //先遍历链表找到中间结点
        ListNode fast = A;
        ListNode slow = A;
        while(fast != null && fast.next != null){
            fast = fast.next.next;
            slow = slow.next;
        }
        //翻转后面的链表
        ListNode cur = slow.next;
        while(cur != null){
            ListNode curNode = cur.next;
            cur.next = slow;
            slow = cur;
            cur = curNode.next;
        }

        //判断 分奇偶
        while(head != slow){
            if(head.val != slow.val){
                return false;
            }
            //偶数
            if(head.next == slow){
                return true;
            }
            head = head.next;
            slow = slow.next;
        }
        return turn;
    }
}
